<template>
	<view>
		<uni-nav-bar left-icon="arrowthinleft" title="预定记录" :border="false" :fixed="true" bg="bg-fff" color="#333" @clickLeft="goBack()"></uni-nav-bar>
		<view v-for="(item,index) in list" :key='index' class="margin-top-20 bg-fff padding-x-24">
			<view class="solid-bottom padding-y-30 fs-28 color-333">{{item.pid_name}}：<text class="color-zhuse fw-600">{{item.room_name}}</text></view>
			<view class="h40 flex align-center justify-between">
				<text class="fs-26 color-666">客户电话</text>
				<text class="fs-26 color-333">{{item.mobile}}</text>
			</view>
			<view class="h40 flex align-center justify-between">
				<text class="fs-26 color-666">预定时间</text>
				<text class="fs-26 color-999">{{item.create_time}}</text>
			</view>
		</view>
		<view class="nomore" :class="loadStatus" v-if="list.length"></view>
		<empty v-if="list.length < 1"></empty>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				q:{
					shop_id:'',
					page:1
				},
				hasMore: true,
				loadStatus: '',
				list: [],
			}
		},
		onLoad(opt) {
			this.q.shop_id = opt.shop_id;
			this.getInfo()
		},
		onReachBottom() {
			if(this.hasMore){
				this.q.page += 1;
				this.getInfo();
			}
		},
		methods:{
			getInfo(){
				this.isLoading = true;
				this.$api.room_order_list(this.q).then(res=>{
					if(res.code == 1){
						this.isLoading = false;
						this.list = [...this.list, ...res.data.data];
						if (res.data.data.length != 0) {
							this.hasMore = true;
							this.loadStatus = '';
						} else {
							this.hasMore = false;
							this.loadStatus = 'over';
						}
					}
				})
			}
		}
	}
</script>

<style>
	page{background: #F7F7F7;}
</style>
